USER_RECHARGE_REPORT = {
    'group_by': "_mch_type",
    'real_time_report': False,
    'interval_type_list': ['day'],
    'target_event_id': ['agency_recharge_success', 'user_recharge_create', 'user_recharge_success',
                        'user_recharge_chase', 'user_recharge_comment', 'user_recharge_complain'],
    'values': [
        {
            "value_id": "agency_recharge_success_count",
            "target_value": "_agency_id",
            "value_name": "申请次数",
            "filter": [
                {"term": {"_event_id": "agency_recharge_success"}}
            ],
            "operation": "value_count",
            "value_type": "long"
        },
        {
            "value_id": "agency_recharge_success_amount",
            "target_value": "agency_recharge_success_amount",
            "value_name": "申请金额",
            "filter": [
                {"term": {"_event_id": "agency_recharge_success"}}
            ],
            "operation": "sum",
            "value_type": "float"
        },
        {
            "value_id": "user_recharge_create_count",
            "target_value": "_user_id",
            "value_name": "发起人数",
            "filter": [
                {"term": {"_event_id": "user_recharge_create"}}
            ],
            "operation": "cardinality",
            "value_type": "long"
        },
        {
            "value_id": "user_recharge_create_times",
            "target_value": "_user_id",
            "value_name": "发起次数",
            "filter": [
                {"term": {"_event_id": "user_recharge_create"}}
            ],
            "operation": "value_count",
            "value_type": "long"
        },
        {
            "value_id": "user_recharge_success_count",
            "target_value": "_user_id",
            "value_name": "充值人数",
            "filter": [
                {"term": {"_event_id": "user_recharge_success"}}
            ],
            "operation": "cardinality",
            "value_type": "long"
        },
        {
            "value_id": "user_recharge_success_times",
            "target_value": "_user_id",
            "value_name": "充值次数",
            "filter": [
                {"term": {"_event_id": "user_recharge_success"}}
            ],
            "operation": "value_count",
            "value_type": "long"
        },
        {
            "value_id": "user_recharge_success_amount",
            "target_value": "user_recharge_success_amount",
            "value_name": "充值金额",
            "filter": [
                {"term": {"_event_id": "user_recharge_success"}}
            ],
            "operation": "sum",
            "value_type": "float"
        },
        {
            "value_id": "user_recharge_apply_rate",
            "value_name": "发起成功率",
            "value_expr": "user_recharge_success_count / user_recharge_create_count",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "user_recharge_success_rate",
            "value_name": "订单成功率",
            "value_expr": "user_recharge_success_times / user_recharge_create_times",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "user_recharge_chase_count",
            "target_value": "_user_id",
            "value_name": "追分次数",
            "filter": [
                {"term": {"_event_id": "user_recharge_chase"}}
            ],
            "operation": "value_count",
            "value_type": "long"
        },
        {
            "value_id": "user_recharge_chase_amount",
            "target_value": "user_recharge_chase_amount",
            "value_name": "追分金额",
            "filter": [
                {"term": {"_event_id": "user_recharge_chase"}}
            ],
            "operation": "sum",
            "value_type": "float"
        },
        {
            "value_id": "user_recharge_comment_count",
            "target_value": "_user_id",
            "value_name": "评价次数",
            "filter": [
                {"term": {"_event_id": "user_recharge_comment"}}
            ],
            "operation": "value_count",
            "value_type": "long"
        },
        {
            "value_id": "user_recharge_good_comment_count",
            "target_value": "_user_id",
            "value_name": "好评次数",
            "filter": [
                {"term": {"_event_id": "user_recharge_comment"}},
                {"term": {"user_recharge_comment_comment_rank": 3}}
            ],
            "operation": "value_count",
            "value_type": "long"
        },
        {
            "value_id": "user_recharge_bad_comment_count",
            "target_value": "_user_id",
            "value_name": "差评次数",
            "filter": [
                {"term": {"_event_id": "user_recharge_comment"}},
                {"term": {"user_recharge_comment_comment_rank": 1}}
            ],
            "operation": "value_count",
            "value_type": "long"
        },
        {
            "value_id": "agency_complain_count",
            "target_value": "_user_id",
            "value_name": "投诉次数",
            "filter": [
                {"term": {"_event_id": "user_recharge_complain"}}
            ],
            "operation": "value_count",
            "value_type": "long"
        }
    ]
}
